package com.drinks.yiniang.adapter.user.milepost;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.AbsoluteSizeSpan;

import com.chad.library.adapter.base.BaseViewHolder;
import com.drinks.yiniang.R;
import com.drinks.yiniang.adapter.base.BaseQuickRCVAdapter;
import com.drinks.yiniang.entity.user.milepost.MilepostUnlockJson;
import com.drinks.yiniang.entity.user.points.PointsExchangeJson;
import com.drinks.yiniang.utils.GlideUtils;
import com.hansen.library.ui.widget.image.RatioRoundImageView;
import com.hansen.library.utils.ScreenSizeUtils;
import com.hansen.library.utils.StringUtils;

import java.util.List;

/**
 * 里程碑首页最近解锁列表adapter
 * @author han
 * @date 2019/8/30
 */
public class MilepostAdapter extends BaseQuickRCVAdapter<MilepostUnlockJson.MilepostUnlockList, BaseViewHolder> {

    public MilepostAdapter(Context mContext, @Nullable List<MilepostUnlockJson.MilepostUnlockList> data) {
        super(R.layout.item_milepost_unlock_wine, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MilepostUnlockJson.MilepostUnlockList item) {
        //封面
        GlideUtils.loadSquareImage(mContext, (RatioRoundImageView) helper.getView(R.id.iv_milepost_unlock_cover), item.getCover_url());
        //解锁就名称
        helper.setText(R.id.tv_milepost_unlock_name, String.format(mContext.getString(R.string.text_unlock_wine_format), StringUtils.getNullEmptyConvert__(item.getTitle())));
        //时间
        helper.setText(R.id.tv_milepost_unlock_time, item.getCreated_at());
        //获得积分
        helper.setText(R.id.tv_milepost_unlock_points_exp, String.format(mContext.getString(R.string.text_get_point_and_exp_format), StringUtils.getNullEmptyConvertZero(item.getPoint()), StringUtils.getNullEmptyConvertZero(item.getExp())));
    }
}
